<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2020/12/28
  Time: 15:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //获取项目名称
    String path = request.getContextPath();
    //获取: 协议://服务器名称:/端口号+ path +"/"
    //http://localhost:8080/StuAndTeacher/  --->main.jsp
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <title>Title</title>
    <base href="<%=basePath%>">
    <link rel="stylesheet" href="layui/css/layui.css">
    <script src="jquery/jquery-1.8.3.js"></script>
    <script src="layui/layui.js"></script>
</head>
<body>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<table id="demo" lay-filter="test"></table>
<script>
    layui.use('table',function () {
        var table = layui.table;
        //第一个实例
        tableResult = table.render({
            elem: '#demo' //获取table标签对象,准备填充数据
            , url: 'ServletAllStuSco' //获取数据的接口(servlet)
            /*,where:{} */  //传额外参数到servlet
            , page: true //开启分页
            , size: "lg" //设置表格大小
            , limit: 5  //每页显示的条数是几条 (默认会向servlet发送 page(1)--第一页 和 limit(10)--显示10条 两个参数)
            , limits: [5, 10, 15, 20, 25] //设置每页显示几条数据'
            , toolbar: true  //工具头,开启 删选,导出,打印的根据头(显示在表格的右边)
            , cols: [[ //表头
                {title: '编号', fixed: 'left', align: "center", type: "numbers", width: 100}
                , {field: 'stuNum', title: '学号', fixed: 'left', align: "center"}
                , {field: 'stuName', title: '姓名', align: "center"}
                , {field: 'stuClass', title: '班级', align: "center"}
                , {field: 'major', title: '专业', align: "center"}
                , {field: 'sumScore', title: '总分', align: "center"}
                , {field: 'avg', title: '平均分', align: "center"}

            ]]
        });

    });



</script>
</body>
</html>
